Azure Information Protection (AIP) is a cloud-based solution that helps organizations classify, label, and protect sensitive information based on policies. It provides a REST API for programmatic interaction, allowing you to automate tasks related to information protection. Below, I'll provide an overview of the Azure Information Protection API and a simplified example in Python using the requests library.

Azure Information Protection REST API:

Features:

  1. Labels:

  2. Protection:

  3. Scanner:

Example in Python using the requests library:

Below is a simplified example demonstrating how to use the Azure Information Protection REST API to retrieve labels. Ensure you have the necessary Azure AD authentication details and replace placeholders with your actual values.

 

import requests

# Specify your Azure Information Protection details
aip_tenant_id = 'your-aip-tenant-id'
api_version = 'v1.0' # Replace with the appropriate API version

# Azure AD authentication details
tenant_id = 'your-tenant-id'
client_id = 'your-client-id'
client_secret = 'your-client-secret'
resource_url = 'https://api.aadrm.com/'

# Get Azure AD token for authentication
token_endpoint = f'https://login.microsoftonline.com/{tenant_id}/oauth2/token'
token_data = {
'grant_type': 'client_credentials',
'client_id': client_id,
'client_secret': client_secret,
'resource': resource_url
}
token_response = requests.post(token_endpoint, data=token_data)
access_token = token_response.json()['access_token']

# Retrieve labels from Azure Information Protection
aip_labels_endpoint = f'https://api.aadrm.com/{api_version}/templates'
headers = {'Authorization': f'Bearer {access_token}'}
response = requests.get(aip_labels_endpoint, headers=headers)
labels = response.json()

# Print label details
for label in labels:
print(f"Label Name: {label['name']}")
print(f"Label Description: {label['description']}")
print("----------------------------")

 

This example demonstrates how to retrieve labels from Azure Information Protection using the requests library in Python. Ensure that you replace the placeholder values with your actual Azure Information Protection details and Azure AD authentication information.

For production environments, it's recommended to use Azure SDKs for Python, such as msal, for a more convenient and secure approach. Install the required library using:

bash
pip install msal

Refer to the official Azure Information Protection REST API documentation for the latest information and API details.